#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <linux/input.h>

#define path  "/dev/SPI_device"

int main(int argc, char** argv)
{
    int error = -20;
    int fd = open(path,O_RDWR);
    if (fd < 0){
        printf("open file %s failed!\r\n",path);
        return -1;
    }

    error = write(fd, NULL, 0);
    if (error < 0){
        printf("write the file failed\n");
    }

    error = read(fd, NULL, 0);
    if (error < 0){
        printf("read the file failed\n");
    }

    error = close(fd);
    if (error < 0){
        printf("close the file failed\n");
    }
    return 0;
}